/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ori
 */
@Entity
@Table(name = "Compass")
@NamedQueries({
    @NamedQuery(name = "Compass.findAll", query = "SELECT c FROM Compass c"),
    @NamedQuery(name = "Compass.findByDirection", query = "SELECT c FROM Compass c WHERE c.direction = :direction"),
    @NamedQuery(name = "Compass.findByDescription", query = "SELECT c FROM Compass c WHERE c.description = :description")})
public class Compass implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "direction")
    private Integer direction;
    @Basic(optional = false)
    @Column(name = "description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "direction1")
    private Collection<Transportation> transportationCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "direction2")
    private Collection<Transportation> transportationCollection1;

    public Compass() {
    }

    public Compass(Integer direction) {
        this.direction = direction;
    }

    public Compass(Integer direction, String description) {
        this.direction = direction;
        this.description = description;
    }

    public Integer getDirection() {
        return direction;
    }

    public void setDirection(Integer direction) {
        this.direction = direction;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Collection<Transportation> getTransportationCollection() {
        return transportationCollection;
    }

    public void setTransportationCollection(Collection<Transportation> transportationCollection) {
        this.transportationCollection = transportationCollection;
    }

    public Collection<Transportation> getTransportationCollection1() {
        return transportationCollection1;
    }

    public void setTransportationCollection1(Collection<Transportation> transportationCollection1) {
        this.transportationCollection1 = transportationCollection1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (direction != null ? direction.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Compass)) {
            return false;
        }
        Compass other = (Compass) object;
        if ((this.direction == null && other.direction != null) || (this.direction != null && !this.direction.equals(other.direction))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Compass[direction=" + direction + "]";
    }

}
